//模块主窗口
HisTaskListPanel = Ext.extend(Ext.Panel,{
	 closable: true,
   	 autoScroll:true,
   	 eeee:11,
   	 width:'100%',
   	 initComponent : function() {
   			this.tbar =  this.buildBbar() ;
   			var gd = new HisTaskListGrid() ;
   			this.items = [gd] ;
			
   		HisTaskListPanel.superclass.initComponent.call(this);
   	 },
   	 buildBbar: function() {
		return ['->',{
                      text:'操作说明'          
                      ,iconCls:'ico-dot-question'
                      ,handler:function(btn){}
		}]
   	 },
   	 exportData:function(btn) {
   		
   		
   	},
   	listeners : {
   		'activate':function(com){
   		var a = com;
   			com.items.get(0).getStore().load({
					params:{
					start:0,
					limit:100
					}
			});
   			return true;
   		}
   	}
});



//高额用户信息列表
HisTaskListGrid = Ext.extend(Ext.grid.GridPanel,{
	title : '高额用户信息列表',
	header: false,
	loadMask:{msg:'加载中...'},
	columnLines:true,
	enableDragDrop: false,
	height: 600,
	viewConfig :{
        forceFit: true
    },
	initComponent : function() {
       	var thisGrid = this;
       	this.recordStart = 1 ;
    	var checkBoxCm = new Ext.grid.CheckboxSelectionModel({
				dataIndex: "uid",
                sortable: false,
                singleSelect:false,
                width:20
		});
		var recordNum = new　Ext.grid.RowNumberer({
		　　header　:　"序号",
		　　width　:　35,
		　　renderer:function(value,metadata,record,rowIndex){
		　　　return　　thisGrid.recordStart　+　rowIndex;
		　　}
		});
		var groupStore = new Ext.data.JsonStore({
			url : 'work_getSubGroup.action',
			root: 'root',
	        fields:["paramValue", "paramDisplay"]
		});
		this.groupStore = groupStore;
		var formpanel = new Ext.form.FormPanel({
				text : "表单",
				layout : "form",
				region : "center",
				frame : true,
				labelAlign : "right",
				width : '100%',
				labelWidth:80,
				items : [{
					xtype:"fieldset",
					collapsible: true,
					layout:'table',
					layoutConfig:{
	            	tableAttrs: {
       					align:'left'
   					 },
	            	columns: 3
				 	},
		    		titleCollapse:true,
		            title: "上级处理意见",
		            autoHeight:true,
		            items:[{ 
				    	layout : "form",
				    	colspan:1,
				    		items:[{width:150,xtype:'textfield',fieldLabel:"上级人员",name:"superStaffName",tips:true,readOnly:true,style:'background:#E6E6E6'}]
				    		},
				    		{ 
				    	layout : "form",
				    	colspan:1,
				    		items:[{width:150,xtype:'textfield',fieldLabel:"部门",name:"superDeptName",tips:true,readOnly:true,style:'background:#E6E6E6'}]
				    		},
				    		{ 
				    	layout : "form",
				    	colspan:1,
				    		items:[{width:150,xtype:'textfield',fieldLabel:"维护组",name:"superGroupName",tips:true,readOnly:true,style:'background:#E6E6E6'}]
				    		},{ 
				    	layout : "form",
				    	colspan:3,
				    		items:[{fieldLabel:"处理意见",width:600,xtype:'textarea',name:"superMessage",readOnly:true,style:'background:#E6E6E6'}]
				    		},{ 
				    	layout : "form",
				    	colspan:1,
				    		items:[{fieldLabel:"起始时间",width:150,xtype:'textfield',name:"superStartDate",readOnly:true,style:'background:#E6E6E6'}]
				    		},{ 
				    	layout : "form",
				    	colspan:1,
				    		items:[{fieldLabel:"结束时间",width:150,xtype:'textfield',name:"superEndDate",readOnly:true,style:'background:#E6E6E6'}]
				    		}
				    ]
				},{
					xtype:"fieldset",
					collapsible: true,
		    		titleCollapse:true,
		            title: "我的处理描述",
		            autoHeight:true,
		            layout:'table',
					layoutConfig:{
	            	tableAttrs: {
       					align:'left'
   					 },
	            	columns: 4
				 	},items:[{ 
				    	layout : "form",
				    	colspan:1,
				    		items:[{width:150,xtype:'textfield',fieldLabel:"姓名",tips:true,name:"staffName",readOnly:true,style:'background:#E6E6E6'}]
				    		},
				    		{ 
				    	layout : "form",
				    	colspan:1,
				    		items:[{width:150,xtype:'textfield',fieldLabel:"部门",tips:true,name:"deptName",readOnly:true,style:'background:#E6E6E6'}]
				    		},
				    		{ 
				    	layout : "form",
				    	colspan:2,
				    		items:[{width:150,xtype:'textfield',fieldLabel:"维护组",tips:true,name:"groupName",readOnly:true,style:'background:#E6E6E6'}]
				    		},{
				    		  layout : "form",
				    		  colspan:4,
				    		  cls:'retrive_panel',
				    		  items:[{xtype:'container'
				    		  		  ,fieldLabel:'挽回操作'
				    		  		  ,layout:'table'
				    		  		  ,columns: 7
				    		  		  ,items:[{colspan:1,xtype:'button',text:'上传文件',handler:function(){
				    		  		  	      //得到选择行的值
				    		  		  	      var recData =this.ownerCt.ownerCt.ownerCt.ownerCt.recData
				    		  		           new Ext.Window({
													width : 650,
													modal:true,
													title : '任务'+recData.get('taskName')+"文件上传",
													height : 300,
													layout : 'fit',
													buttonAlign:'center',
													items : [
														{
															xtype:'uploadPanel',
															border : false,
															deleteUrl:'upload_deleteFile.action',
															fileSize : '500 MB',//限制文件大小
															uploadUrl : 'upload_swfLoad.action',
															flashUrl : 'js/mycom/uploader/swfupload.swf',
															filePostName : 'file', //后台接收参数
															fileTypes : '*.xls;*.xlsx',//可上传文件类型
															file_types_description:'excel表格文件',
															postParams : {dir:'retrive',taskId:recData.get('taskId')} ,//上传文件存放目录
															fileCount:1
														}
														
													]
												   ,buttons:[{text:'确定',handler:function(){
												  		 	var panel =this.ownerCt.ownerCt.getComponent(0);
												  		 	var count =0;
												  		 	var param={};
												  		 	param.fileNames="";
												  		 	param.filePaths="";
												  		 	param.taskId=recData.get('taskId');
												  		 	param.mainProcessId=recData.get('mainProcessId');
												  		 	param.subProcessId=recData.get('subProcessId');
												  		 	param.activityInsId=recData.get('activityInsId');
												  		 	param.taskSeqNo=recData.get('taskSeqNo');
														for(var i=0;i<panel.gp.getStore().getCount();i++){
															var rec =panel.gp.getStore().getAt(i);
															if(rec.get('state')==-4){
															    count++;
															    param.fileNames+=":"+rec.get('name');
															    param.filePaths+=":"+rec.get('url');
															}
														}
														if (count==0) {
															MsgTip.msg({
															 	msg:"没有上传成功的文件！",
															 	pos:"center"
														  		});
															return;
														}
														param.fileNames=param.fileNames.substring(1);
														param.filePaths=param.filePaths.substring(1);
														
														//请求
														var myMask = new Ext.LoadMask(this.ownerCt.ownerCt.getEl(), {msg:"请稍等，正保存导入文件日志中。。。"});
														myMask.show();
														Ext.Ajax.request({
															url:'retrive_addLog.action'
															,params:param
															,method:'post'
															,success:function(result,requst) {
																var page =Ext.decode(result.responseText);
																	myMask.hide();
																if (page.status ==200){
																	panel.ownerCt.close();
																	delete param.fileNames;
																	delete param.filePaths;
																	Ext.Ajax.request({
																		url:'retrive_startDealExcel.action'
																		,params:param
																		,method:'post'
																		,success:function(result,requst) {
																			MsgTip.msg({
																		 	msg:"请点击<font color='red'>查看文件</font>按钮，查看处理情况!",
																		 	pos:"center"
																	  		});
																		}
																	});
																}
															}
															,failure:function(){
																myMask.hide();
															}
														})
												   }}
												          ,{text:'关闭'
												            ,handler:function(){
												            	var panel =this.ownerCt.ownerCt.getComponent(0);
													   		 	var count =0;
																for(var i=0;i<panel.gp.getStore().getCount();i++){
																	var rec =panel.gp.getStore().getAt(i);
																	if(rec.get('state')==-4){
																	    count++;
																	}
																}
																if (count>0) {
																	Ext.Msg.confirm('警告','有'+count+"文件已经成功上传确定要关闭？关闭后，上传文件将删除?",function(n){
																	           if (n =='yes') {
																	           	   //删除文件ajax
																	           	   //请求
																				   var myMask = new Ext.LoadMask(panel.ownerCt.getEl(), {msg:"请稍等，正在删除文件中。。。"});
																				   myMask.show();
																				   var exp =false;
																	           	   try {
																	           	   		panel.onDeleteAll(false);
																	           	   } catch (err){
																	           	   	    exp =true;  
																	           	   	     MsgTip.msg({
																						 	msg:"移除失败！",
																						 	cmp:panel.ownerCt,
																						 	pos:"center"
																	  				  });
																	           	   }
																	           	   if (!exp) {
																		           	   myMask.hide();
																		           	   panel.ownerCt.close();
																	           	   }
																	           }
																	});
																} else {
												            		panel.ownerCt.close();
																}
												            }}]
												}).show();
				    		  		  	   
				    		  		      }}
				    		  		  		 ,{colspan:1,xtype:'spacer',width:20}
				    		  		  		 ,{colspan:1,xtype:'button',text:'查看文件',handler:function(){
				    		  		  		       var recData =this.ownerCt.ownerCt.ownerCt.ownerCt.recData;
				    		  		  		       new Ext.Window({
														width : 800,
														title : '已上传文件',
														height : 300,
														modal:true,
														params:{
											        	        taskId:recData.get('taskId')
											        	        ,mainProcessId:recData.get('mainProcessId')
											        	        ,subProcessId:recData.get('subProcessId')
											        	        ,activityInsId:recData.get('activityInsId')
														       },
														layout : 'fit',
														buttonAlign:'center',
														items : [{
														    xtype:'grid'
														    ,loadMask:{msg:'请稍候，正在加载中。。。'}
														    ,tbar:[{text:'刷新'
														    		,handler:function(){
														    		    var grid =this.ownerCt.ownerCt;
														    		    grid.getStore().load({
														        	     	params:grid.ownerCt.params
														        	});
														    		
														    		}},'-']
														    ,store:{
														       xtype:'jsonstore'
														       ,fields:['seqNo','operator','operTime','fileName','mainProcessId','subProcessId','activityPnsId','taskSeqNo','taskId','operateFlag','filePath','resultInfo']
														       ,url:'retrive_getRetriveLog.action'
														       ,root:'root'
														    }
														    ,viewConfig:{
														    }
														    ,columnLines:true
														    ,listeners:{
														        'afterrender':function(){
														        	this.getStore().load({
														        	     params:this.ownerCt.params
														        	});
														        }
														    }
														    ,columns:[
														    	{header:'文件名',dataIndex:'fileName',width:200}
														    	,{header:'操作时间',dataIndex:'operTime',width:200}
														    	,{header:'处理状态',dataIndex:'operateFlag',width:100,renderer:function(value){
														    	              var retv =value;
														    	              if (value =="0") {
														    	              	retv="导入";
														    	              } else if (value =="1") {
														    	              	retv ="解析中";
														    	              }else if (value=='2') {
														    	              	retv ="处理成功"
														    	              } else if (value =="3"){
														    	              	retv ='处理失败';
														    	              }
														    	              return retv;
														    	}}
														    	,{header:'处理结果',width:50,dataIndex:'resultInfo',width:300,cellTip:true}
														    	,{header:'操作',width:150,dataIndex:'seqNo'
														    		,renderer:function(value){
														    				return "<a href='#' id='"+value+"'  style='color:blue;margin-right:10px;' class='delete-file' ext:qtip='删除导入记录并删除文件'>删除</a>"+
														    					"<a href='#' id='"+value+"'  style='color:blue;margin-left:20px;' class='update-file' ext:qtip='重新处理该条记录'>重新处理</a>"
														    		},processEvent:function(name, e, grid, rowIndex, colIndex){
														    	        if(name =="click") {
														    	        	var m = e.getTarget().className;
														    	        	var id =e.getTarget().id;
														    	        	if (m =='delete-file') {
														    	        		var myMask = new Ext.LoadMask(grid.el, {msg:"请稍等,正在删除中..."});
														    	        		Ext.Msg.confirm('确认','确认要删除记录？',function(n){
														    	        		         if (n=='yes') {
														    	        		         	myMask.show();
														    	        		         	Ext.Ajax.request({
														    	        		         	    loadTask:myMask
														    	        		         	    ,url:'retrive_deleteLog.action'
														    	        		         	    ,params:{seq_no:id}
														    	        		         	    ,success:function(result,request) {
														    	        		         	    	var page =Ext.decode(result.responseText);
														    	        		         	    	myMask.hide();
														    	        		         	    	if (page.status==200) {
														    	        		         	    		MsgTip.msg({msg:'删除记录成功',cmp:grid,pos:'center'});
														    	        		         	    		grid.store.load({
																							        	     params:grid.ownerCt.params
																							        	});
														    	        		         	    	}
														    	        		         	    	
														    	        		         	    }
														    	        		         	    ,failure:function(result,request) {
														    	        		         	    	myMask.hide();
														    	        		         	    }
														    	        		         	});
														    	        		         	
														    	        		         } 
														    	        		});
														    	        		
														    	        	} else if(m=='update-file') {
														    	        		var myMask = new Ext.LoadMask(grid.el, {msg:"请稍等,正在开启重新处理线程中..."});
														    	        		Ext.Msg.confirm('确认','确认要重新处理记录？',function(n){
														    	        		         if (n=='yes') {
														    	        		         	myMask.show();
														    	        		         	Ext.Ajax.request({
														    	        		         	    loadTask:myMask
														    	        		         	    ,url:'retrive_reDealExcel.action'
														    	        		         	    ,params:{seq_no:id}
														    	        		         	    ,success:function(result,request) {
														    	        		         	    	var page =Ext.decode(result.responseText);
														    	        		         	    	myMask.hide();
														    	        		         	    	if (page.status==200) {
														    	        		         	    		MsgTip.msg({msg:'重新处理开始',cmp:grid,pos:'center'});
														    	        		         	    		grid.store.load({
																							        	     params:grid.ownerCt.params
																							        	});
														    	        		         	    	}
														    	        		         	    	
														    	        		         	    }
														    	        		         	    ,failure:function(result,request) {
														    	        		         	    	myMask.hide();
														    	        		         	    }
														    	        		         	});
														    	        		         	
														    	        		         } 
														    	        		});
														    	        	}
														    	        	return this.fireEvent(name, this, grid, rowIndex, e);
														    	        } else if(name == 'mousedown'){
														    	        	return false;
														    	        }
														    	        
														    		}
														    	}
														    ]
														}]
											 	}).show()
				    		  		  		 }}
				    		  		  		 ,{colspan:1,xtype:'spacer',width:20}
				    		  		  		 ,{colspan:1,xtype:'button',text:'模板下载',cls:'retrive-button-module',handler:function(){
				    		  		              window.open('upload_downFile.action?fileFileName='+this.filePath);
				    		  		           }
				    		  		          }
				    		  		         ,{colspan:1,xtype:'spacer',width:20}
				    		  		         ,{colspan:1,xtype:'label',html:'<font color="red" >稽核如果产生实际效益请在此上传挽回情况</font>'}
				    		  		 ]}]
				    		},{ 
				    	layout : "form",
				    	colspan:4,
				    		items:[{fieldLabel:"处理意见",width:600,readOnly:true,style:'background:#E6E6E6',xtype:'textarea',name:"processResult.processMessage"}]
				    		},{ 
				    	layout : "form",
				    	colspan:3,
				    		items:[{fieldLabel:"分发组",
				    			xtype: 'lovcombo',
				    			hidden:true,
					        	store : groupStore,   
						         displayField:'paramDisplay',
						         valueField:'paramValue',
						         hiddenName:'processResult.groupId',
						         mode : 'remote',
						         editable:false,
						         tips:true,
						         triggerAction: 'all',   
						         emptyText:'选择分发组' 
				    		}]
				    		},{ 
				    	layout : "form",
				    	colspan:1,
				    		items:[{xtype:'button',hidden:true,text:"提&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;交",
				    			handler :function(btn) {
				    				thisGrid.submitTask(thisGrid);
				    			}
				    		}]
				    		}
				    		
				 		]
				}],
				buttonAlign :'center',
				minButtonWidth:60,
				buttons:[{
					text:"关闭",
					handler : function(btn){
						this.ownerCt.ownerCt.ownerCt.hide();
				}
				}]
		});
		this.assTaskFormPanel = formpanel;
		this.assTaskPanel = new Ext.Window({
	   			layout:"fit",
	   			title: "任务处理",
	   			closeAction: 'hide',
				resizable:false,
				modal:true,
				width:800,
				height:445,
				items :[formpanel]
   			});
		
		this.columns　=　[checkBoxCm,recordNum,　
		    {
				header:'稽核点名称',
				sortable:true,
				dataIndex:"taskName",
				width:120
			},{
				header:'稽核任务名称',
				sortable:true,
				dataIndex:"taskDesc",
				width:150
			},{
				header:'问题描述',
				sortable:true,
				dataIndex:"issueInfo",
				width:200,
				renderer: function(value, metaData, record, rowIndex, colIndex, store) {
		   			metaData.attr = ' ext:qtip="' + value + '"';
		   			return value;
		   		}
			},{
				header:'严重级别',
				sortable:true,
				dataIndex:"warnLevel",
				width:80
			},{
				header:'维护组',
				sortable:true,
				dataIndex:"groupName",
				width:150
			},{
				header:'创建时间',
				sortable:true,
				dataIndex:"startTime",
				width:120
			},{
				header:'完成时间',
				sortable:true,
				dataIndex:"endTime",
				width:120
			},
//			{
//				header:'查看处理情况',
//				xtype: 'actioncolumn',
//            	width: 100,
//            	align :"center",
//           		items: [
//                {
//                    icon   : 'images/edit.gif',               
//                    tooltip: '查看数据',
//                    handler: function(grid, rowIndex, colIndex) {
//                		var taskId = grid.getStore().getAt(rowIndex) .data['taskId'];
//                		var processInstId = grid.getStore().getAt(rowIndex) .data['procInstId'];
//                		new HisTaskListPanel.process({taskId:taskId,processInstId:processInstId}).show();
//                    }
//                }]
//			},
//			{
//				header:'查看整体情况',
//				xtype: 'actioncolumn',
//            	width: 50,
//            	align :"center",
//           		items: [
//                {
//                    icon   : 'images/edit.gif',               
//                    tooltip: '查看数据',
//                    handler: function(grid, rowIndex, colIndex) {
//                		var taskId = grid.getStore().getAt(rowIndex) .data['taskId'];
//                		new HisTaskListPanel.processAll({taskId:taskId}).show();
//                    }
//                }]
//			},
//			{
//				header:'数据处理',
//				xtype: 'actioncolumn',
//            	width: 100,
//            	align :"center",
//           		items: [
//                {
//                    icon   : 'images/edit.gif',               
//                    tooltip: '查看数据',
//                    handler: function(grid, rowIndex, colIndex) {
//                			var taskId = grid.getStore().getAt(rowIndex) .data['id']; 
//                			var main = grid.ownerCt.ownerCt;
//                			var cid = "panel-task-"+grid.id+taskId;
//                			var b = main.getComponent(cid);
//                			
//                			if(b) {
//    							main.setActiveTab(b);
//    							return;
//                			}
//                			Ext.Ajax.request({
//							    url:"work_getTaskParams.action?type=2&taskId="+taskId, 
//							    success:function (response) {
//									var Result=Ext.decode(response.responseText);
//									var jsSource = Result.data.URL_SOURCE;
//									var name =  Result.data.OBJECT_NAME;
//									var text =  Result.data.TEXT;
//									var conObj = Result.objCondition;
//									if(conObj){
//											var p = "'condObj':{";
//												
//												for(var o in conObj) {
//													p += "'"+o+"':'"+conObj[o]+"',"
//												}
//												p = p.substring(0,p.length-1);
//											if(name.indexOf("})")!=-1) {
//												name = name.trim();
//												name = name.substring(0,name.indexOf("})"));
//												name = name+","+p+"}})";
//											}else {
//												name = name.trim();
//												name=name+"({"+p+"}})";
//											}
//									}
//									//alert(name);
//									var afterLoader = Result.data.AFTER_LOADER;
//									if(Result.success) {
//										Ext.Loader.load([jsSource],function(){
//		    											eval('var a = new '+name);
//				    										a.title = text;
//				    										a.id = cid; 
//		    												main.add(a);
//		    												main.setActiveTab(a);
//		    												if(afterLoader && afterLoader!=null) {
//		    													eval(afterLoader+"(a)") ;
//		    												}
//		    										});
//										
//										
//									}else{
//										
//									}
//								  }
//							   });
//                    }
//                }]
//			},
			{
				header:'操作',
				xtype: 'actioncolumn',
            	width: 100,
            	align :"center",
           		items: [
           			{
                    icon   : 'images/home/search-add.png',               
                    tooltip: '查看稽核任务处理详情',
                    handler: function(grid, rowIndex, colIndex) {
                		var taskId = grid.getStore().getAt(rowIndex) .data['taskId'];
                		var processInstId = grid.getStore().getAt(rowIndex) .data['procInstId'];
                		new HisTaskListPanel.process({taskId:taskId,processInstId:processInstId}).show();
                    }
                },'-',
                {
                    icon   : 'images/edit.gif',               
                    tooltip: '数据定位',
                    handler: function(grid, rowIndex, colIndex) {
                			var taskId = grid.getStore().getAt(rowIndex) .data['id']; 
                			var main = grid.ownerCt.ownerCt;
                			var cid = "panel-task-"+grid.id+taskId;
                			var b = main.getComponent(cid);
                			
                			if(b) {
    							main.setActiveTab(b);
    							return;
                			}
                			Ext.Ajax.request({
							    url:"work_getTaskParams.action?type=2&taskId="+taskId, 
							    success:function (response) {
									var Result=Ext.decode(response.responseText);
									var jsSource = Result.data.URL_SOURCE;
									var name =  Result.data.OBJECT_NAME;
									var text =  Result.data.TEXT;
									var conObj = Result.objCondition;
									if(conObj){
											var p = "'condObj':{";
												
												for(var o in conObj) {
													p += "'"+o+"':'"+conObj[o]+"',"
												}
												p = p.substring(0,p.length-1);
											if(name.indexOf("})")!=-1) {
												name = name.trim();
												name = name.substring(0,name.indexOf("})"));
												name = name+","+p+"}})";
											}else {
												name = name.trim();
												name=name+"({"+p+"}})";
											}
									}
									//alert(name);
									var afterLoader = Result.data.AFTER_LOADER;
									if(Result.success) {
										Ext.Loader.load([jsSource],function(){
		    											eval('var a = new '+name);
				    										a.title = text;
				    										a.id = cid; 
		    												main.add(a);
		    												main.setActiveTab(a);
		    												if(afterLoader && afterLoader!=null) {
		    													eval(afterLoader+"(a)") ;
		    												}
		    										});
										
										
									}else{
										
									}
								  }
							   });
                    }
                },
                {
                    icon   : 'images/info.gif',                // Use a URL in the icon config
                    tooltip: '查看处理结果',
                    handler: function(grid, rowIndex, colIndex) {
							  var taskId = grid.getStore().getAt(rowIndex) .data['id'];
							  
//							 MsgTip.msg({
//							 	msg:"还未实现",
//							 	cmp:grid,
//							 	pos:"topl"
//							 });
//							  Ext.Ajax.request({
//							    url:"work_getTaskParamValue.action?type=2&taskId="+taskId, 
//							    success:function (response) {
//									var Result=Ext.decode(response.responseText);
//									if(Result.success) {
//										grid.getStore().reload();
//									}else{
//										Ext.Msg.alert("错误","任务签收失败~~" );
//									}
//								  }
//							   });
							  grid.assTask(grid,rowIndex);
                    }
                }]
			}] ;
		var dataStore = new Ext.data.JsonStore({
			url : 'work_getHisTaskList.action',
			root: 'root',
	        totalProperty: 'totalProperty',
	        idProperty: 'id',
	        fields: [
				'id','gropId','workDefineName','groupName','warnLevel','workDefineId','taskName','taskDesc','taskId','issueInfo','procInstId','createDate','startTime','endTime','assignee'	        ]
		});
	
	    dataStore.baseParams ={'highFeeUser':null};
		this.store = dataStore;
		this.sm = checkBoxCm;
		this.mk=new Ext.LoadMask(Ext.getBody(),{
							msg:'正在努力为您加载数据，请稍候...'
				});
		this.bbar = new Ext.PagingToolbar({
			pageSize : 100,
			store : dataStore,
			displayInfo : true,
			displayMsg : '第 {0} - {1} 条  共 {2} 条',
			emptyMsg : "没有记录",
			listeners:{
				beforechange:function(pt,obj) {
					thisGrid.recordStart = obj.start+1 ;
				}
			}
		});
	HisTaskListGrid.superclass.initComponent.call(this);
	},
	listeners : {
   		'afterrender':function(com) {
   			com.getStore().load({
					params:{
					start:0,
					limit:100
					}
			});
   		}
//	,
//   		'beforeshow':function(){
//   			alert(1);
//   			return true;
//   		}
   	},
		assTask:function(grid,indexRow) {
		if (!grid.assTaskPanel.rendered) {
			grid.assTaskPanel.show();
			grid.assTaskPanel.hide();
		}
		var tp =grid.assTaskPanel.items.get(0);
		//得到页面保存的一些taskid的常量
		if (!tp.taskData){
			tp.taskData =new Ext.util.MixedCollection();
		}
		var set =tp.items.get(0) ;
		set.setVisible(false);
		grid.assTaskPanel.setSize(800,287);
		//把该行数据保存在页面上。主要是取以下5个值
		//taskId mainProcessId subProcessId activityInsId taskSeqNo
		tp.recData=grid.getStore().getAt(indexRow);
		
		//测试数据
		/*
		tp.recData.set('taskId','103001001004') ;
		tp.recData.set('mainProcessId',1);
		tp.recData.set('subProcessId',1) ;
		tp.recData.set('activityInsId',1);
		*/
		
		//得到收入挽回的按钮。用来判断是否需要显示
		var retrivePanel =Ext.query('div.retrive_panel',tp.el.dom);
		//得到下载模板的按钮
		//var downModule =Ext.getCmp(Ext.query('.retrive-button-module',retrivePanel[0])[0].id);
		var realtaskId =tp.recData.get('taskId');
		tp.currentTaskId=realtaskId;
		retrivePanel[0].parentElement.parentElement.style.display="none";
			            grid.assTaskPanel.setSize(grid.assTaskPanel.getWidth(),grid.assTaskPanel.getHeight()-27);
		//查看是否已经有配置了
		/*
		var taskConfig =tp.taskData.get(realtaskId);
		if (taskConfig==undefined ||taskConfig==null) {
			
			 * taskConfig 已有属性
			 * isretrive 是否有挽回
			 * filePath 模板路径
			 
			taskConfig={};
			Ext.Ajax.request({
			  url:'retrive_isRetrive.action'
			  ,params:{taskId:realtaskId}
			  ,success:function(result,request) {
			       var page =  Ext.decode(result.responseText);
			       if (page.success) {
			          var data =page.data;
			          taskConfig.isretrive =data.isretrive;
			          if (data.isretrive){
			          	taskConfig.filePath =data.filePath;
			          	downModule.filePath =taskConfig.filePath;
			          } else {
			            retrivePanel[0].parentElement.parentElement.style.display="none";
			            grid.assTaskPanel.setSize(grid.assTaskPanel.getWidth(),grid.assTaskPanel.getHeight()-27);
			          }
			          //请求 取得是否有收入挽回的配置
					tp.taskData.add(realtaskId,taskConfig);
			       } else {
			       	  MsgTip.msg({
					 	msg:"收入挽回加载异常",
					 	pos:"center",
					 	cmp:grid
							 });
			       	  retrivePanel[0].parentElement.parentElement.style.display="none";
			       	  grid.assTaskPanel.setSize(grid.assTaskPanel.getWidth(),grid.assTaskPanel.getHeight()-27);
			       }
			       grid.assTaskPanel.show();
			  }
			 ,failure:function(){
			 	MsgTip.msg({
					 	msg:"收入挽回加载异常",
					 	pos:"center",
					 	cmp:grid
							 });
			 	retrivePanel[0].parentElement.parentElement.style.display="none";
			 	grid.assTaskPanel.setSize(grid.assTaskPanel.getWidth(),grid.assTaskPanel.getHeight()-27);
			 	grid.assTaskPanel.show();
			 }
			})
			
		} else {
			if (!taskConfig.isretrive){
				retrivePanel[0].parentElement.parentElement.style.display="none";
				grid.assTaskPanel.setSize(grid.assTaskPanel.getWidth(),grid.assTaskPanel.getHeight()-27);
			} else {
				downModule.filePath =taskConfig.filePath;
			}
			grid.assTaskPanel.show();
		}
		*/
		
		var taskId = grid.getStore().getAt(indexRow) .data['id'];
		grid.switchTaskId = taskId;
		grid.groupStore.baseParams={'taskId':taskId} ;
		var taskName = grid.getStore().getAt(indexRow) .data['workDefineName']; 
		Ext.Ajax.request({
		    url:"work_getTaskProResult.action?type=2&taskId="+taskId, 
		    success:function (response) {
				var Result=Ext.decode(response.responseText);
				var obj = Result.data;
				if(Result.success) {
					if(obj) {
						if(obj.hasSuper=="1") { 
							set.setVisible(true);
							grid.assTaskPanel.setSize(grid.assTaskPanel.getWidth(),grid.assTaskPanel.getHeight()+167);
						}
						grid.assTaskFormPanel.getForm().setValues({
							"superStaffName":obj.superStaffName,
							"staffName":obj.staffName,
							"superGroupName":obj.superGroupName,
							"groupName":obj.groupName,
							"superMessage":obj.superMessage,
							"processResult.processMessage":obj.message,
							"taskName":taskName,
							"superDeptName":obj.superDeptName,
							"deptName":obj.deptName,
							"startDate":obj.startDate,
							"superStartDate":obj.superStartDate,
							"superStaffName":obj.superStaffName,
							"endDate":obj.endDate,
							"superEndDate":obj.superEndDate
						});
					} 
					grid.assTaskPanel.show();
				}else{
					//MsgTip.msg('消息', '数据加载异常,请重试~',grid,true,5);
					 MsgTip.msg({
							 	msg:"数据加载异常,请重试~",
							 	pos:"botl",
							 	cmp:grid
							 });
				}
			  }
		});
	}
});

/**
 * 展示处理详情
 */
HisTaskListPanel.process = Ext.extend(Ext.Window,{
	title:'处理详情',
	width:1100,
	height:550,
	layout:'border',
	modal:true,
	closeAction:'close',
	initComponent: function(){
		this.items = [new HisTaskListPanel.process.treeGrid({taskId:this.taskId,processInstId:this.processInstId})];
//		this.html = "<embed allowscriptaccess=\"never\" allownetworking=\"internal\" invokeurls=\"false\" " +
//					"src=\"HelloWorld.swf\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" " +
//					"type=\"application/x-shockwave-flash\" quality=\"high\" autostart=\"0\" " +
//					"wmode=\"transparent\" width=\"100%\" height=\"300\" align=\"middle\">";
		HisTaskListPanel.process.superclass.initComponent.call(this);
	}
});

/**
 * 展示全部处理详情结构
 * @memberOf {TypeName} 
 */
HisTaskListPanel.processAll = Ext.extend(Ext.Window,{
	title:'全部流程详情',
	width:800,
	height:550,
	layout:'border',
	modal:true,
	closeAction:'close',
	initComponent: function(){
		this.items = [new HisTaskListPanel.processAll.treeGrid({taskId:this.taskId})];
		HisTaskListPanel.process.superclass.initComponent.call(this);
	}
});

HisTaskListPanel.process.treeGrid = Ext.extend(Ext.ux.tree.TreeGrid,{
	region:'center',
	autoScroll:true,
	enableSort:false,
	lines:true,
	columns:[{
            header: '维护组名称 | 稽核任务名称',
            dataIndex: 'groupName',
            width: 400,
            sortable: false
        },{
            header: '组长',
            width: 100,
            dataIndex: 'groupLeader'
        },{
            header: '组员',
            width: 100,
            dataIndex: 'groupMember'
        },{
            header: '处理人员',
            width: 100,
            dataIndex: 'staffName'
        },{
            header: '处理状态',
            width: 50,
            dataIndex: 'status',
            renderer: function(value, metaData, record, rowIndex, colIndex, store) {
	   			metaData.attr = ' ext:qtip="' + value + '"';
	   			return "<img src='images/infocard.png'/>"+value ;
	   		}
        },
//        {
//            header: '稽核流程名称',
//            width: 150,
//            dataIndex: 'procName'
//        },{
//            header: '稽核任务名称',
//            width: 150,
//            dataIndex: 'procTaskName'
//        },
        {
            header: '开始时间',
            width: 150,
            dataIndex: 'startTime'
        },{
            header: '结束时间',
            width: 150,
            dataIndex: 'endTime'
        }],
	listeners:{
		'beforecollapsenode' : function(){
			return false;
		}
	},
	initComponent: function(){
		this.dataUrl = 'work_getProcessDetail.action?taskId='+this.taskId+'&processId='+this.processInstId;
		HisTaskListPanel.process.treeGrid.superclass.initComponent.call(this);
	}
});

HisTaskListPanel.processAll.treeGrid = Ext.extend(Ext.ux.tree.TreeGrid,{
	region:'center',
	autoScroll:true,
	hideCollapseTool: true,
	collapsible: true,
	columns:[{
            header: '组名称',
            dataIndex: 'groupName',
            width: 230
        },{
            header: '组长',
            width: 100,
            dataIndex: 'groupLeader'
        },{
            header: '组员',
            width: 150,
            dataIndex: 'groupMember'
        },{
            header: '流程名称',
            width: 150,
            dataIndex: 'procDefName'
        },{
            header: '流程任务名称',
            width: 150,
            dataIndex: 'procTaskName'
        }],
	listeners:{
		'beforecollapsenode' : function(){
			return false;
		}
	},
	initComponent: function(){
		this.dataUrl = 'work_getAllProcessDetail.action?taskId='+this.taskId;
		HisTaskListPanel.processAll.treeGrid.superclass.initComponent.call(this);
	}
});

